<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 全局作用域
      // 全局变量
      var str = "jksk ak askj ";
      function fn2() {
        console.log(str);
      }

      fn2();

      //   局部作用域
      function fn2() {
        var str2 = "jksk ak askj ";
        console.log(str2);
      }

      fn2();

      console.log(fn2);

      //块级作用域
      {
        // 块级作用域中的变量
        let str3 = "jksk ak askj ";
        var str4 = "OJSSJKAS";
        console.log(str3);
      }

      console.log(str4);
      console.log(str3);
    </script>
  </body>
</html>
